import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Footer from './components/Footer.vue'
import 'font-awesome/css/font-awesome.min.css'
import axios from 'axios'
import qs from'qs'
const app = createApp(App);
axios.defaults.baseURL='http://localhost:8080/EleSSM/'
axios.defaults.withCredentials=true
import{
    getCurDate,
    setSessionStorage,
    getSessionStorage,
    removeSessionStorage,
    setLocalStorage,
    getLocalStorage,
    removeLocalStorage
}from './common.js'

app.config.globalProperties.$axios = axios
app.config.globalProperties.$qs = qs
app.config.globalProperties.$getCurDate = getCurDate;
app.config.globalProperties.$setSessionStorage=setSessionStorage;
app.config.globalProperties.$getSessionStorage=getSessionStorage;
app.config.globalProperties.$removeSessionStorage=removeSessionStorage;
app.config.globalProperties.$setLocalStorage=setLocalStorage;
app.config.globalProperties.$getLocalStorage=getLocalStorage;
app.config.globalProperties.$removeLocalStorage=removeLocalStorage;


// router.beforeEach(function(to,from,next){
//     let user = sessionStorage.getItem('user');
//     if(!(to.path=='/'||to.path=='/index'|| to.path=='/businessList'||to.path=='/businessInfo'||to.path=='./login'||to.path=='./register')){
//         if(user ==null){
//             router.push('./login');
//             location.reload();
//         }
//     }
//     next();
// });
app.component('Footer',Footer).use(store).use(router).mount('#app')

